package com.chouxiaozi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/consumer/payment")
public class ConsumerPaymentController {
    private final String url = "http://PROVIDER-PAYMENT";

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/hello")
    public String getPaymentById() {
        return restTemplate.getForObject(url+"/payment/hello",String.class);
    }

    @GetMapping("/zipkin")
    public String paymentZipkin()
    {
        String result = restTemplate.getForObject(url+"/payment/zipkin/", String.class);
        return result;
    }
}
